/*
Symmetric Tree

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).

For example, this binary tree is symmetric:

1
/ \
2   2
/ \ / \
3  4 4  3
But the following is not:
1
/ \
2   2
\   \
3    3
Note:
Bonus points if you could solve it both recursively and iteratively.

confused what "{1,#,2,3}" means? > read more on how binary tree is serialized on OJ.
*/

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <stack>
#include <fstream>
#include <sstream>
#include "print.h"
using namespace std;

/**
* Definition for binary tree*/
struct TreeNode {
	int val;
	TreeNode *left;
	TreeNode *right;
	TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};



void testForStack()
{
	stack<int> mystack;
	mystack.push(10);
	mystack.push(20);
	mystack.top() -= 5;
	cout << "mystack.top() is now " << mystack.top() << endl;
}

void testForIntToString()
{
	int a = 10;
	stringstream ss;
	ss << a;
	string str = ss.str();
	cout << str << endl;

	string str1 = to_string(a);

}





class Solution {
public:

	
	
	bool isSameTree(TreeNode *p, TreeNode *q) {

		if (p == NULL && q == NULL)
		{
			return true;
		}
		else if (p == NULL || q == NULL)
		{
			return false;
		}

		return	p->val == q->val && isSameTree(p->left, q->right) && isSameTree(p->right, q->left);
		

	}



	bool isSymmetric(TreeNode *root) {

		if (root == NULL)
		{
			return true;
		}
		else if (root->left ==NULL && root->right != NULL )
		{
			return false;
		}
		else if (root->right == NULL && root->left != NULL)
		{
			return false;
		}
		else if (root != NULL && root->right == NULL && root->left == NULL)
		{
			return true;
		}
		else
		{
			return isSameTree(root->left, root->right);
		}

	}
};



int main(int argc, char* argv[])
{

	Solution s;


	for (int i = 1; i < argc; i++){


		cout << argv[i] << endl;

	}

	int A[] = { 1, 2, 3, 0, 0 };
	int B[] = { 2, 4 };
	//cout << << endl;



	system("pause");
	return 0;
}